package com.changfen.client.util;

import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.StatefulRedisConnection;

/**
 * @author 86180
 * @Classname RedisUtils
 * @Description TODO
 * @Date 2022/9/6 21:36
 */
public class RedisUtils {
    /**
     * 获取redis客户端
     *
     * @return
     */
    public static RedisClient getRedisClient() {
        RedisURI redisUri =
                RedisURI
                        .builder()
                        .withHost("localhost")
                        .withPort(6379)
                        .withPassword("thingsmatrix@8".toCharArray())
                        .build();
        return RedisClient.create(redisUri);
    }

    public static StatefulRedisConnection<String, String> getConnection(RedisClient redisClient) {
        return redisClient.connect();
    }

}
